import React, {Component} from 'react';
import './css/01-index.css'
import Home from './tabCase2/home'
import Cinema from './tabCase2/cinema'
import My from './tabCase2/my'
import Tablebar from "./tabCase2/tablebar";
import Topbar from "./tabCase2/topbar";
class App extends Component {
    state = {
        list: [
            {
                id: 0,
                name: '首页'
            }, {
                id: 1,
                name: '影院'
            }, {
                id: 2,
                name: '我的'
            },
        ],
        current:0
    }

    render() {

        return (
            <div>
                <Topbar myEvent={()=>{
                    this.setState({
                        current:2
                    })
                }}></Topbar>
                {
                    this.witch()
                }
                <Tablebar event={(index)=>{
                    this.setState({
                        current:index
                    })
                }} current={this.state.current} list={this.state.list}></Tablebar>
            </div>
        );
    }



    witch(){
        switch (this.state.current) {
            case 0:
                return <Home></Home>
            case 1:
                return <Cinema></Cinema>
            case 2:
                return <My></My>
            default:
                return null
        }
    }
}

export default App;
